package com.firebugsoft.calc.web.api.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.firebugsoft.calc.dubbo.api.service.ICalcService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = {"/calc"})
public class CalcController {
    @Reference
    private ICalcService calcService;

    @RequestMapping(value = {"/add"})
    public double add(double a, double b) {
        return calcService.add(a, b);
    }

    @RequestMapping(value = {"/sub"})
    public double sub(double a, double b) {
        return calcService.sub(a, b);
    }

    @RequestMapping(value = {"/mul"})
    public double mul(double a, double b) {
        return calcService.mul(a, b);
    }

    @RequestMapping(value = {"/div"})
    public double div(double a, double b) {
        return calcService.div(a, b);
    }
}
